<?php

if(!empty($_GET['id'])){
	$id=$_GET['id'];
	$arr=getone('brand','id='.$id);
		unlink($arr['logo']);
$row=delete('brand','id='.$id);
if($row>0){
	echo '<script>alert ("删除成功");location="index.php?admin=1&c=brand&a=list";</script>';
	};
};

if(!empty($_POST)){
	// print_r($_POST);
	// 
	$id=($_POST['id']);
$where=' ';
foreach($id as $key => $value){
	$where.='id='.$value.' or ';
	};
	$where=substr($where,0,-4);
	$arr=getlist('brand',$where);
	
	foreach ($arr as $key => $value) {
		unlink($value['logo']);
	}
$sum=delete('brand',$where);
if($sum>0){
	echo '<script>alert ("删除成功");location="index.php?admin=1&c=brand&a=list";</script>';
	};
}else{
	echo '<script>alert ("请选择要删除的记录");location="index.php?admin=1&c=brand&a=list";</script>';
	};

?>